<template>
	<view>
		<!-- 列表循环 -->
		<view class="">
			<u-gospeedware :value="list" @click="topage"></u-gospeedware>
		</view>
	</view>
</template>

<script>
	import uGospeedware from '../../components/page-component/u-goods-list/u-gospeed-ware.vue';
	let mallurl = null
	let loadcom = false
	export default {
		data() {
			return {
				page: 1,
				limit: 10,
				page_count: 1,
				list: [],
				mall_id: 1
			}
		},
		components: {
			uGospeedware
		},
		onLoad(options) {
			this.mall_id = options.mall_id || 1
			mallurl = this.$siteInfo.apiroot + '?_mall_id=' + this.mall_id + '&r='
			this.appPort()
		},
		onReachBottom() {
			if (loadcom) {
				if (this.page < this.page_count) {
					this.page++;
					this.appPort()
				}
			}
		},
		methods: {
			async appPort() {
				// 9.9修
				loadcom = false
				let url = this.$api.navs.mersq
				if (this.mall_id == 1) {
					url = this.$api.navs.mersq
				} else {
					url = mallurl + this.$apiUrl.navs.mersq
				}
				const res = await this.$request({
					url: url,
					data: {
						page: this.page,
						status: 1,
						limit: this.limit,
						// 10.27 添加好货快抢的标识
						pid: 3
					}
				});
				if (res.code === 0) {
					loadcom = true
					let listvideo = []
					let status = ''
					this.page_count = res.data.pagination.page_count;
					listvideo = res.data.list
					this.list = this.list.concat(listvideo)
					uni.stopPullDownRefresh()
				} else {
					uni.stopPullDownRefresh()
					uni.showModal({
						title: '提示',
						content: res.msg,
					})
				}
			},
			topage(item) {
				let url = '/pages/goods/recodevi?id=' + item.id + '&mall_id=' + this.mall_id
				if (item.content != undefined) {
					if (item.status != 1) {
						uni.navigateTo({
							url: url
						})
					}
				} else {
					uni.navigateTo({
						url: item.url
					})
				}
			},
		}
	}
</script>

<style scoped lang="scss">

</style>
